<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class ArticleResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {
        return [
			'id' => (int)$this->id,
			'title' => (string)$this->title,
			'cover' => (string)$this->cover,
			'published_time' => (string)$this->published_time,
			'author' => new AuthorResource($this->author),
        ];
    }
}
